#!/usr/bin/python

from sys import argv

def parseWeps(file):
    for line in file:
        traits = ""
        traitsL = line.split("\"")
        if len(traitsL) == 3:
            traits = traitsL[1]
            traits = traits.replace(" ",  "")
            line = "".join([traitsL[0],  traitsL[2]])
        
        lineL = line.split(',')
        if len(lineL) < 11:
            continue
        
        name = lineL[0]
        label = lineL[1].lower()
        label
        print "\t\"%s\" : { " % (label), 
        
        acc = lineL[2]
        if acc is '-' or acc is'':
            acc = "0"
        print "\"acc\" : \"%s\"," % (acc), 
        
        rangePB = lineL[3]
        rangeCR = lineL[4]
        rangeER = lineL[5]
        if rangeER is '-' or rangeER is '':
            rangeER = "0"
        print "\"er\" : \"%s\"," % (rangeER), 
        
        dam = lineL[6]
        if dam.startswith("x"):
            dam = dam[1:]
        print "\"dam\" : \"%s\"," % (dam), 
        
        if lineL[7] is not "":
            traits = lineL[7]
        if traits is not "":
            print "\"traits\" : \"%s\"," % (traits), 
        
        type = lineL[8].strip()
        if type is not "-" or type is not "":
            print "\"type\" : \"%s\"," % (type), 
        
        ammo = lineL[9]
        if not (ammo is "-" or ammo is ""): 
            print "\"ammo\" : \"%s\"," % (ammo), 
        
        order = lineL[10].strip()
        if order is '-' or order is '':
            order = 0
        print "\"sortOrder\" : \"%s\"" % (order), 
                
        print " }, "

if __name__ == '__main__':
    f = open(argv[1], 'r')
    parseWeps(f)
